<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initialscale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
</head>

<body>
   <div id="app">
    <!-- vue绑定事件 -->
    <button v-on:click="search()">查询</button>
    <!-- 简写方式 -->
    <button @click="search()">查询1</button> 

    <!-- v-on 指令绑定事件，click指定绑定的事件类型，事件发生时调用vue中methods节点中定义的方法 -->
    <button v-on:click="search()">查询</button>
    <p>您要查询的是：{{searchMap.keyWord}}</p>
    <p><a v-bind:href="result.site" target="_blank">{{result.title}}</a></p>
   </div>
   
   <script src="vue.min.js"></script>
   <script>
     new Vue({
         el: '#app',
         data: {
            searchMap: {
                keyWord:'尚硅谷'
            },
            result:{}
          },
          methods:{  //可以定义多个方法
              search(){
                console.log('search');
                this.result = {
                "title":"尚硅谷",
                "site":"http://www.atguigu.com"
                }
              }
          }
     })
 </script>
</body>

</html>